package indi.zhifa.recipe.bailan.framework.auth.service;
import com.alibaba.fastjson2.JSONArray;
import indi.zhifa.recipe.bailan.framework.auth.entity.po.BaseAuthNodeEntity;
import indi.zhifa.recipe.bailan.framework.auth.entity.po.BaseDomainEntity;
import indi.zhifa.recipe.bailan.framework.auth.entity.vo.BaseDepartmentNodeVo;
import indi.zhifa.recipe.bailan.framework.auth.entity.vo.BaseDepartmentWithChildrenVo;
import indi.zhifa.recipe.bailan.framework.auth.entity.vo.BaseDomainVo;
import indi.zhifa.recipe.bailan.framework.auth.entity.vo.BaseDomainWithRootVo;

import java.util.List;
import java.util.Map;

public interface IBaseAuthNodeService {

    /**
     * 初始化部门
     *
     * @param pDomainConfigs
     * @return
     */
    Map<String, BaseDomainVo> init(JSONArray pDomainConfigs);

    /**
     * 领域信息
     *
     * @param pId
     * @return
     */
    BaseDomainEntity domainInfo(Long pId);

    /**
     * 部门信息
     *
     * @param pId
     * @return
     */
    BaseAuthNodeEntity info(Long pId);

    /**
     * 根据部门Id获取部门树
     *
     * @param pId  部门Id
     * @return
     */

    BaseDepartmentNodeVo infoTree(Long pId);

    /**
     * 根据部门Id获取信息并包含子部门信息
     *
     * @param pId   部门Id
     * @return
     */

    BaseDepartmentWithChildrenVo infoWithChildren(Long pId);

    /**
     * 获取所有领域
     *
     * @return
     */
    List<BaseDomainWithRootVo> listBaseDomains();

    /**
     * 创建部门
     *
     * @param pParentId     父级部门Id
     * @param pSavingBaseAuthNodeEntity   部门实体
     * @return
     */

    BaseAuthNodeEntity create(Long pParentId, BaseAuthNodeEntity pSavingBaseAuthNodeEntity);

    /**
     * 部门换根
     *
     * @param pParentId     父级部门Id
     * @param pId           部门Id
     * @return
     */
    BaseDepartmentNodeVo reRoot(Long pParentId, Long pId);

    /**
     * 删除部门
     *
     * @param pId       部门Id
     * @return
     */
    boolean delete(Long pId);

}
